#!/bin/bash
source /root/.bash_profile
#dt=`date '+%Y.%m.%d'`
dt=`date -d "1day ago" '+%Y.%m.%d'`
for i in `cat /root/script/indexname.txt|grep -v ^#` 
do
  echo logstash-${i}-${dt}
  elasticdump --input http://10.202.94.141:17050/logstash-${i}-${dt} --output /root/script/logstash-${i}-${dt}_mapping.json --type=mapping
  elasticdump --input http://10.202.94.141:17050/logstash-${i}-${dt} --output $| bzip2 > /root/script/logstash-${i}-${dt}_data.json.bz2
done

#/nfs/node-v10.15.0-linux-x64/bin/elasticdump --input  /nfs/k8s-data/$mapping.json --output http://10.202.94.141:17050/$i --type=mapping
#/nfs/node-v10.15.0-linux-x64/bin/elasticdump --input  /nfs/k8s-data/$data.json --output http://10.202.94.141:17050/$i --type=data